package ar.com.cema.methodology.analyzer.model;

import java.util.Set;
import java.util.TreeSet;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import ar.com.cema.methodology.analyzer.annotations.GsonExclude;

@Entity
@Table(name="answers")
public class Answer extends PersistentObject {
	
	@GsonExclude
	@ManyToOne
	@JoinColumn(name="survey_id", nullable=false)
	private Survey survey;
	
	@ManyToOne
	@JoinColumn(name="question_id", nullable=false)
	private Question question;

	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="answer_id")
	private Set<MethodologyAnswer> methodologiesAnswers;
	
	public Answer() {
		super();
		this.methodologiesAnswers = new TreeSet<MethodologyAnswer>();
	}
	public Question getQuestion() {
		return question;
	}
	public void setQuestion(Question question) {
		this.question = question;
	}
	public Set<MethodologyAnswer> getMethodologiesAnswers() {
		return methodologiesAnswers;
	}
	public void setMethodologiesAnswers(Set<MethodologyAnswer> methodologiesAnswers) {
		this.methodologiesAnswers = methodologiesAnswers;
	}
	public Survey getSurvey() {
		return survey;
	}
	public void setSurvey(Survey survey) {
		this.survey = survey;
	}
}
